<?php
class courseController extends appController {    
    public function index($id=null, $name=null, $country_id=null, $university_id=null){
        $name = serialize($name);
         $create_date=time();
         $modified_date=time();
        if($_SERVER["REQUEST_METHOD"]=='POST'){
            // print_r($_POST);exit;
            $error = $this->_model->validation();
            if($error){

                    $this->view->set('err',$error);
                }
                $id = $this->_model->courseName($id,$name,$country_id,$university_id,$create_date,$modified_date);
                if($id != null){
                    header('Location: index');
                    exit;
                }
        }
        $getcoursefields = $this->_model->getcoursefields();
        $getuniverName = $this->_model->getuniverName();
        $getCourseName = $this->loadModel("universityModel");
        $getsubject=$getCourseName->getCountry();
        $this->view->set('getsubject',$getsubject);
        $this->view->set('getuniverName',$getuniverName);
        $this->view->set('getcoursefields',$getcoursefields[0]);
        // echo "<pre>"; print_r($getsubject);
        // echo "<pre>";print_r($getCountry);
        return $this->view();
    }

}
?> 